package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Region;
import cn.wolfcode.trip.base.mapper.RegionMapper;
import cn.wolfcode.trip.base.service.IRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author by mycp
 * @Classname RegionServiceImpl
 * @Description TODO
 * @Date 2018/11/2 22:10
 */
@Service
public class RegionServiceImpl implements IRegionService {
    @Autowired
    private RegionMapper regionMapper;

    @Override
    public List<Region> listMenus(Long parentId) {
        List<Region> list = regionMapper.listMenus(parentId);
        return list;
    }

    @Override
    public void save(Region region) {
        regionMapper.insert(region);

    }

    @Override
    public void update(Region region) {
        regionMapper.updateByPrimaryKey(region);
    }

    @Override
    public List<Region> queryForList(Integer state) {
        List<Region> list = regionMapper.selectAll(state);
        return list;
    }

    @Override
    public List<Region> list(Integer state) {
        List<Region> list = regionMapper.selectAll(state);
        return list;
    }
}
